#@bootStrapLayout("商户管理信息界面-房间预订管理")

#define bootStrapMain()
<div class="container">
    #include("../../common/header.html")
    <div class="col-md-12">
        <ol class="breadcrumb">
            <li><a href="#">主页</a></li>
            <li class="active">房间预订管理</li>
            <li></li>
        </ol>
        <!--<a href="/travel/roomOrder/add">+添加</a>-->
    </div>
    <div class="col-md-12">
        <div style="text-align: center;margin:15px;">
            <form class="form-inline">

                <div class="form-group">
                    <label for="mobile">入驻人手机号：</label>
                    <input type="text" class="form-control" id="mobile" placeholder="请输入手机号...">
                </div>
                <button type="button" id="searchBtn" class="btn btn-default">点我检索</button>
            </form>
        </div>
        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <th>ID</th>
                <th>房间名称</th>
                <th>入驻人</th>
                <th>入驻人手机</th>
                <th>入驻时间</th>
                <th>离开时间</th>
                <th>备注信息</th>
                <th>状态</th>
                <th>总价格</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody id="content">
            </tbody>
        </table>
        <div style="text-align: center" >
            <ul class="pagination" id="pagantion">

            </ul>
        </div>
    </div>
</div>
#end

#define bootStrapJs()

<script type="text/x-mustache" id="template">
     {{#items.list}}
            <tr id="item-{{id}}">
                <td>{{id}}</td>
                <td>{{roomName}}</td>
                <td>{{name}}</td>
                <td>{{mobile}}</td>
                <td>{{start_time}}</td>
                <td>{{end_time}}</td>
                <td>{{remarker}}</td>
                <td>{{status}}</td>
                <td>￥{{total_price}}</td>
                <td>
                    <!--<a href="javascript:;" class="delete-btn" data-id="{{id}}">删除</a>|-->
                    <a href="javascript:;" class="edit-btn" data-id="{{id}}">编辑</a>|
                </td>
            </tr>
    {{/items.list}}
</script>

<script>
    $(document).ready(function(){

        $("#searchBtn").click(function(){
            initData();
        });

        initData();

        function initData(){
            var setting = {
                "url":"#(contextPath)/travel/roomOrder/listAll",
                "data":{
                    "roomOrder.mobile":$("#mobile").val(),
                },
            }
            var page = new Pagenation(setting);
            page.init();
        }

        $("#content").on("click",".delete-btn",function(){
            var id = $(this).attr("data-id");
            layer.confirm('确定要进行当前操作？', {
                btn: ['确定','取消']
            }, function(){
                $.ajax({
                    url:"/travel/roomOrder/doDelete",
                    data:{id:id},
                    method:"post",
                    success:function(resp){
                        if(resp.result){
                            layer.msg(resp.data);
                            $("#item-"+id).remove();
                        }else{
                            layer.msg(resp.data);
                        }
                    }
                })
            }, function(){

            });
        });

        $("#content").on("click",".edit-btn",function(){
            var id = $(this).attr("data-id");
            layer.confirm('确定要进行当前操作？', {
                btn: ['确定','取消']
            }, function(){
                window.location.href="/travel/roomOrder/queryById?id="+id
            }, function(){

            });
        });


    })
</script>
#end